using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Reflection;
using System.IO;

namespace Hack.DllDump
{
    public class Event : IComparable
    {
        protected System.Reflection.EventInfo info;

        public Event(EventInfo info)
        {
            this.info = info;
        }

        public void ToString(StringWriter sw)
        {
            sw.WriteLine("Event Handler " + info.EventHandlerType.FullName);

            Method m = new Method(info.GetRaiseMethod());

            sw.Write("Add method: ");
            m.ToString(sw);
            sw.WriteLine("");

            m = new Method(info.GetRemoveMethod());

            sw.Write("Remove Method: ");
            m.ToString(sw);
            sw.WriteLine("");

        }
        /* 
         * Allow these to be sorted by name
         */
        public int CompareTo(object o)
        {
            Event target = (Event)o;
            return info.EventHandlerType.FullName.CompareTo(target.info.EventHandlerType.FullName);
        }
    }
}
